package com.xpec.c4.game.unit;

import com.ms.player.Player;
import com.xpec.c4.game.utility.GUID;
import com.xpec.c4.message.login.CAccountCharacterCreateRequest;

/**
 * 生物的管理类，用于创建生物
 * 
 * Mike_Tung
 * 
 */
public class UnitManager {
	
	/**
	 * 新手起始等级
	 */
	public static final int NEW_GUY_LEVEL = 0;
	
	private static UnitManager instance = new UnitManager();

	/**
	 * 創建角色數量
	 */
	public static int createCount = 0;

	public static UnitManager getInstance() {
		return instance;
	}
	
	private UnitManager()
	{		
	}

	/**
	 * 創建角色<br>
	 * 並賦予此角色先天有的數據(等级、性别等等)
	 * @param gender 性別
	 * @return
	 */
	public static Player createPlayer(boolean gender, GUID accountId) {
		
		createCount++;
		
		Player player = new Player();
		player.setAccountId(accountId);
		player.setLevel(NEW_GUY_LEVEL);
		player.setGender(gender);

		return player;
	}
	
	/**
	 * 創建角色<br>
	 * 並賦予此角色先天有的數據(等级、性别等等)
	 * @param gender 性別
	 * @return
	 */
	public static Player createPlayer(CAccountCharacterCreateRequest message, GUID accountId) {
		
		createCount++;
		
		Player player = new Player();
		player.setAccountId(accountId);
		player.setLevel(NEW_GUY_LEVEL);
		player.setGender(message.gender);
		player.setFacephoto(message.facephoto);
		player.setName(message.name);

		return player;
	}

}
